package com.dyz.controller;

import com.dyz.model.Result;
import com.dyz.model.RolePrivilegesParam;
import com.dyz.service.ISysRolePrivilegeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = "角色权限管理")
public class SysRolePrivilegeController {
    @Resource
    private ISysRolePrivilegeService sysRolePrivilegeService;
    @GetMapping("/role_privileges")
    @ApiOperation(value = "获取角色权限")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleId", value = "角色id"),
    })
    public Result<?> getRolePrivileges(Long roleId) {
        return sysRolePrivilegeService.getRolePrivileges(roleId);
    }
    @PostMapping("/grant_privileges")
    @ApiOperation(value = "授予权限")
    public Result<?> grantPrivileges(@RequestBody RolePrivilegesParam param) {
        return sysRolePrivilegeService.grantPrivileges(param);
    }

}
